package com.chanct.test;

import java.text.SimpleDateFormat;

public class test4 {

	public static void main(String[] args) {
		String path = "2016/0824/1508/4971436216610240121/XZ22#172.200.4.54_56656_61.135.158.90_80_2016-08-24-15-08-50_8529205806478244575Y.eml";
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
		String time = sdf.format(System.currentTimeMillis());
		int number = (int) (Math.random()*9000+1000);
		String fileName = "";
		String[] temp = path.split("/");
		String yFileName = temp[temp.length-1];
		
		String[] temp2 = yFileName.split("\\.");
		String suffixes = temp2[temp2.length-1];
		
		int index = yFileName.lastIndexOf(".");
		if("eml".equals(suffixes)){
			fileName = "mail_"+time+"_"+number+".eml";
		}else{
			fileName = yFileName.substring(0, index)+"_"+time+"_"+number+"."+suffixes;
		}
		System.out.println(fileName);
	}

}
